package com.nj.liandi.gulimall.order.vo;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

public class OrderConfirmVo {

    //收获地址
    List<MemberAddressVo> address;

    //所有选中的购物项
    List<OrderItemVo> items;

    Map<Long,Boolean> stocks;

    public Map<Long, Boolean> getStocks() {
        return stocks;
    }

    public void setStocks(Map<Long, Boolean> stocks) {
        this.stocks = stocks;
    }
//发票记录

    //优惠卷信息
    Integer integration;

//    BigDecimal total; //总金额

//    BigDecimal payPrice; //应付价格

    String orderToken; //订单防重令牌

    public String getOrderToken() {
        return orderToken;
    }

    public Integer getCount(){
        Integer i =0;
        if (items!=null) {
            for (OrderItemVo item : items) {
                i += item.getCount();
            }
        }
        return i;
    }

    public void setOrderToken(String orderToken) {
        this.orderToken = orderToken;
    }

    public List<MemberAddressVo> getAddress() {
        return address;
    }

    public void setAddress(List<MemberAddressVo> address) {
        this.address = address;
    }

    public List<OrderItemVo> getItems() {
        return items;
    }

    public void setItems(List<OrderItemVo> items) {
        this.items = items;
    }

    public Integer getIntegration() {
        return integration;
    }

    public void setIntegration(Integer integration) {
        this.integration = integration;
    }

    public BigDecimal getTotal() {
        BigDecimal sum = new BigDecimal("0");
        if (items!=null) {
            for (OrderItemVo item : items) {
                BigDecimal multiply = item.getPrice().multiply(new BigDecimal(item.getCount().toString()));
                sum =sum.add(multiply);
            }
        }
        return sum;
    }


    public BigDecimal getPayPrice() {
        return getTotal();
    }

}
